import fs from 'fs';
import path from 'path';
import {Manifest} from "webextension-polyfill"

// 定义 manifest 对象
const manifest: Manifest.WebExtensionManifest = {
  manifest_version: 3,
  name: 'FileViewUtilsWebExtension',
  version: '1.0',
  content_scripts: [
    {
      matches: ['*'],
      js: ['content.js']
    }
  ],
  permissions: ['notifications'],
};

// 将 manifest 对象转换为 JSON 字符串
const manifestJson = JSON.stringify(manifest);

// 确定输出路径
const outputPath = path.join(__dirname, 'public', 'manifest.json');

// 创建 dist 目录（如果不存在）
fs.mkdirSync(path.dirname(outputPath), {recursive: true});

// 写入 manifest.json 文件
fs.writeFileSync(outputPath, manifestJson, 'utf8');
